package com.demo;

import java.util.HashMap;
import java.util.Map;

/**
 * SSO接口
 */
public class ScimallApi {


	 public static void main(String[] args) {
		 /**
		  * 测试环境绑定hosts:122.14.45.44 openapi-test.scimall.org.cn
		  * 测试环境：http://openapi-test.scimall.org.cn
		  * 生产环境：https://openapi.scimall.org.cn
		  */
		 String url = "http://openapi-test.scimall.org.cn";
		 String appId = "请联系开发人员";
		 String secretKey = "请联系开发人员";
		 /**
		  * 从接口获取 sign 和 token
		  */
		 String sign = "04bca870b48317670ee0555b21a76f16";
		 String token = "8b717d63-611f-4868-8939-7de7b1e9a00d";
		 
		 Map<String, Object> param = new HashMap<>();
	        param.put("sso_sign", sign);
	        param.put("sso_token", token);
	        
	     //获取sn算法
		 String sn = HttpClient.buildSn(appId, secretKey, param);
		 System.out.println(sn);
		 
		 
		 //获取用户信息
		 String userInfo = HttpClient.getUserInfo(url, appId, secretKey, sign, token);
		 System.out.println(userInfo);
		 
	 }
	
}
